package com.jieshuibao.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jieshuibao.mapper.CategoryMapper;
import com.jieshuibao.model.db.Category;
@Service
public class CategoryService {
	@Autowired
	private CategoryMapper categoryMapper;
	
	public List<Category> getCategoryTree(String id){
		return categoryMapper.selectCategoryByParentId(id);
	}
	
	public void addCategory(Category category){
		categoryMapper.insertCategoery(category);
	}
	
	public Category getCategoryById(String id){
		return categoryMapper.selectCategoryAllById(id);
	}

	public Category selectCategoryById(String categoryId) {
		return categoryMapper.selectCategoryById(categoryId);
	}
}
